package com.hdyg.sixg.mvp.presenter;

import com.hdyg.sixg.entry.ImageBean;
import com.hdyg.sixg.httpUtil.HttpCallback;
import com.hdyg.sixg.mvp.Contrant.CAppeal;
import com.hdyg.sixg.mvp.base.BasePresenter;
import com.hdyg.sixg.util.ToastUtil;
import java.io.File;
import java.util.Map;

/**
 * @author CZB
 * @describe 申诉
 * @time 2019/4/15 9:54
 */
public class PAppeal extends BasePresenter implements CAppeal.IPAppeal {

    private CAppeal.IVAppeal mView;

    public PAppeal(CAppeal.IVAppeal mView) {
        this.mView = mView;
    }

    @Override
    public void pGetSureAppeal(String path, Map<String, String> params) {
        mModel.post(path, params, new HttpCallback(true) {
            @Override
            public void onSuccess(Object dataBean) {
                mView.vGetSureAppealSuccess(dataBean.toString());
            }

            @Override
            public void onFail(String code, String error) {
                ToastUtil.show(error);
            }
        });
    }

    @Override
    public void pGetUploadImg(String path, File file, String fileKey, Map<String, String> params) {
        mModel.postImg(path, params, fileKey, file, new HttpCallback<ImageBean>(true) {
            @Override
            public void onSuccess(ImageBean dataBean) {
                mView.vGetUploadImgSuccess(dataBean);
            }

            @Override
            public void onFail(String code, String error) {
                ToastUtil.show(error);
            }
        });
    }
}
